﻿using System.Collections.Generic;
using Might.Infrastructure.ModelicaDOM;

namespace Might.Modelica.Annotations.Graphics {
    ///<summary>
    ///</summary>
    [Mapping("Transformation")]
    public class Transformation  {
        ///<summary>
        ///</summary>
        public Transformation() {
            origin = new GraphicsPoint();
            extent = new GraphicsExtent();
            rotation = 0;
        }

        ///<summary>
        ///</summary>
        ///<param name="origin"></param>
        ///<param name="extent"></param>
        ///<param name="rotation"></param>
        public Transformation(GraphicsPoint origin, GraphicsExtent extent, double rotation) {
            this.origin = origin;
            this.extent = extent;
            this.rotation = rotation;
        }

        ///<summary>
        ///</summary>
        [Mapping("origin")]
        public GraphicsPoint origin { get; set; }

        ///<summary>
        ///</summary>
        [Mapping("extent")]
        public GraphicsExtent extent { get; set; }

        ///<summary>
        ///</summary>
        [Mapping("rotation")]
        public double rotation { get; set; }

        [UnknownMapping]
        public List<object> UnknownItems { get; set; }

        public bool IsDefault {
            get {
                return origin.IsDefault &&
                    extent.IsDefault &&
                        rotation == 0;
            }
        }

        // TODO why this? commented
        //[Mapping("x")]
        //private double X {
        //    get { return Origin.X; }
        //    set { Origin.X = value; }
        //}

        //[Mapping("y")]
        //private double Y {
        //    get { return Origin.Y; }
        //    set { Origin.Y = value; }
        //}

        //[Mapping("scale")]
        //public double Scale { get; set; }
    }
}